
// import {print} from 'nc-lightapp-front';

import print from '../../../../../hrpub/common/utils/print';

import language from '../../language';

export default function() {

    const {
        editTable,
        meta
    } = this.props;

    let allTableList = editTable.getAllRows('ncc60071025list');
    let template = meta.getMeta();

    let oids = [];
    allTableList.map((item) => {
        oids.push(item.values['pk_psnjob'].value);
    })

    let hisOptions = {};
    template['ncc60071025list'].items.map((item) => {
        if(item.attrcode === 'pk_psndoc.ishiskeypsn') {
            item.options.map((opt) => {
                hisOptions[opt.value] = opt.display;
            });
        }
    });

    print(document.getElementById('keyPsnMainTable'), {
        title: language['hi6007-000244'],
        maker: language['hi6007-000245'],
        date: language['hi6007-000246'],
        beforeAppend: (data) => {
            // data[0].map((item) => {
            //     item.splice(0, 1);
            // });
            
            data[1].map((item) => {
                if(/false/.test(item[1])) {
                    item[1] = hisOptions['N']
                }
                else if(/true/.test(item[1])) {
                    item[1] = hisOptions['Y']
                }
            });
            data[1].map((item) => {
                item.splice(item.length - 1, 1);
            });

            return data;
        }
    }, {
        data: allTableList,
        tableTmp: template['ncc60071025list']
    });
}